package com.cc.mapper;

import com.cc.pojo.Emp;
import com.cc.pojo.EmpQueryParam;
import com.cc.pojo.JobCountData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {


    List<Emp> list(EmpQueryParam param);

    void delect(List<Integer> ids);

    void add(Emp emp);
    @Select("select * from emp where id=#{id}")
    Emp getID(Integer id);

    void update(Emp emp);
    @Select("""
        select
            case job when 1 then '班主任'
            when 2 then '讲师'
            when 3 then '学工主管'
            when 4 then '教研主管'
            when 5 then '咨询师'
            else '其他'
            end as jobName,
            count(*) as num
        from emp group by job
        order by num
""")
    List<JobCountData> countEmpJobData();




    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp getUsernameAndPassword(Emp emp);


    List<Emp> findAll();

    List<Map> getEmpGenderData();
}
